package com.example.project.manageController;

import com.example.project.dao.ParkingDAO;
import com.example.project.dao.ParkingTypeDAO;
import com.example.project.pojo.Parking;
import com.example.project.pojo.ParkingType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

//4
@Controller
@RequestMapping("manage")
public class MangeParkingAddController {

    @RequestMapping("parkingAdd")
    public String parkingAdd(Model model)
    {
        ParkingTypeDAO parkingTypeDAO =new ParkingTypeDAO();
        List<ParkingType> parkingTypeList =parkingTypeDAO.findAll();
        model.addAttribute("parkingTypeList",parkingTypeList);
        return "/manage/parkingAdd";
    }
    @RequestMapping("adminParkingAdd")
    public String adminParkingAdd(Parking parking)
    {

        ParkingDAO parkingDAO = new ParkingDAO();
        parkingDAO.AdminCarAdd(parking);

        return "redirect:/manage/parkingCheck";
    }


}
